#!/bin/sh
ulimit -c unlimited 
export ROOT=$(cd `dirname $0`; pwd)
export DAEMON=false


##查找skynet的根目录
if [ ! $SKYNET ]; then  
  echo "can't find skynet path!"
  exit 1  
fi 

##生成 run目录
if [ ! -d "$ROOT/run" ]; then 
	mkdir "$ROOT/run"
fi


export PIDFILE=$ROOT/run/web.pid
export LOGFNAME=web

while getopts "dk" arg
do
	case $arg in
		d)
			export DAEMON=true
			;;
		k)
			kill `cat $PIDFILE`
			exit 0;
			;;
	esac
done



$SKYNET/skynet $ROOT/etc/web_config.lua
